﻿using System.IO;
using System.Reflection;

namespace EntityLibrary.Business.BasicInfo.Sql
{
    class SQLFileHelper
    {
        public static string GetSql(string statementName)
        {
            string sql = string.Empty;

            string namespacePart = "EntityLibrary";
            string resourceName = namespacePart + ".Business.BasicInfo.Sql." + statementName;

            using (Stream stm = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
            {
                if (stm != null)
                {
                    sql = new StreamReader(stm).ReadToEnd();
                }
            }
            return sql;
        }
    }
}
